package com.zy.stock.controller;

import java.io.StringWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.zy.stock.domain.UserStockRl;
import com.zy.stock.quartz.AnalyzeJob;
import com.zy.stock.quartz.CrawlJob;

@Controller
public class IndexController {
	private Logger logger = LoggerFactory.getLogger(IndexController.class);
	
	@Autowired
	private CrawlJob job;
	
	@RequestMapping(value="/index")
	public ModelAndView index(){
		ModelAndView mav = new ModelAndView("stockManage");
		mav.addObject("menuid", 4);
		return mav;
	}
	
	@RequestMapping(value="/crawl")
	@ResponseBody
	public String crawl(){
		job.crawl();
		return "success";
	}
}
